﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.DirectX;
using Microsoft.DirectX.Direct3D;


namespace SnakeX
{
	/// <summary>
	/// This class can draw text.
	/// </summary>
	public class SnakeXText
	{
		/// <summary>
		/// Constructor.
		/// Initializing members.
		/// </summary>
		/// <param name="d3dDevice">The device to use when drawing text.</param>
		/// <param name="size">Font size</param>
		/// <param name="weight">Font weight</param>
		/// <param name="fontName">Font name</param>
		public SnakeXText(Device d3dDevice, System.Drawing.Size size, 
			FontWeight weight, string fontName)
		{
			this.d3dDevice = d3dDevice;

			textFont = new Font(d3dDevice, size.Height, size.Width, weight,
				0, false, CharacterSet.Default, Precision.Default,
				FontQuality.Default, PitchAndFamily.FamilyDoNotCare, fontName);
		}


		/// <summary>
		/// Drawing text with the given parameters on the device.
		/// </summary>
		/// <param name="textStr">String to draw</param>
		/// <param name="startPos">Text start position</param>
		/// <param name="color">Text color</param>
		public void Draw(string textStr, System.Drawing.Point startPos,
			System.Drawing.Color color)
		{
			// Drawing text.
			Sprite sprite = null;
			textFont.DrawText(sprite, textStr, startPos, color);
		}


		/// <summary>
		/// The Direct3D device object.
		/// </summary>
		private Device d3dDevice;

		/// <summary>
		/// The text font object.
		/// </summary>
		private Font textFont;
	}
}
